#ifndef SERVICE_H
#define SERVICE_H

#include <QDialog>
#include <QTcpServer>
#include <QTcpSocket>
#include <QtDebug>
#include <QTimer>

namespace Ui {
class Service;
}

class Service : public QDialog
{
    Q_OBJECT

public:
    explicit Service(QWidget *parent = nullptr);
    ~Service();

private slots:
    void on_Create_clicked();
    //响应客户端连接请求槽函数
    void onNewconnection();
    //接受客户端消息槽函数
    void onReadyRead();
    //转发客户端消息函数
    void sendMessage(const QByteArray& buf);
    //定时检查套接字容器
    void onTimeout(void);

private:
    Ui::Service *ui;
    QTcpServer tcpServer;
    quint16 port;
    QList<QTcpSocket*> tcpClientList;
    QTimer timer;
};

#endif // SERVICE_H
